package com.leyou.trade.interceptors;

import com.leyou.auth.constants.JwtConstants;
import com.leyou.auth.local.UserContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

/**
 * @author 虎哥
 */
@Component
public class FeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {
        // 给请求添加请求头
        template.header("Cookie", JwtConstants.COOKIE_NAME + "=" + UserContext.getJwt());
    }
}
